<?php
namespace app\demo\model;
use think\Model;
use think\Db;
use think\Request;

class Brands extends Model{
    public function  index($p,$size,$where){
        $count=Db::table('brand')->where($where)->count();
        $size=Request::instance()->param('size','3');
        $sumpage=ceil($count/$size);
        $limit=($p-1)*$size;
        $data['last']=$p-1<1?1:$p-1;
        $data['next']=$p+1>$sumpage?$sumpage:$p+1;
        $data['show']=Db::table('brand')->where($where)->page($p,$size)->select();
        $data['p']=$p;
        $data['sumpage']=$sumpage;
        $data['size']=$size;
        $data['count']=$count;
        return $data;
    }
}